<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>员工个人中心</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap-icons/1.7.2/font/bootstrap-icons.min.css" rel="stylesheet">
    <style>
        .sidebar {
            min-height: 100vh;
            background-color: #343a40;
            padding-top: 20px;
        }
        .nav-link {
            color: #fff;
            padding: 10px 20px;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.3s ease;
        }
        .nav-link:hover {
            background-color: #495057;
            color: #fff;
            transform: translateX(5px);
        }
        .nav-link.active {
            background-color: #0d6efd;
            color: #fff;
            font-weight: bold;
        }
        .nav-link i {
            font-size: 1.2rem;
        }
        .content {
            padding: 20px;
            background-color: #f8f9fa;
        }
    </style>
</head>
<body>
    <div class="container-fluid">
        <div class="row">
            <!-- 左侧导航栏 -->
            <div class="col-md-2 sidebar">
                <div class="text-center mb-4">
                    <h4 class="text-white">员工个人中心</h4>
                </div>
                <ul class="nav flex-column">
                    <li class="nav-item">
                        <a class="nav-link active" href="#" onclick="showContent('personal-info')">
                            <i class="bi bi-person"></i> 个人信息
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#" onclick="showContent('leave-manage')">
                            <i class="bi bi-calendar"></i> 请假申请
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#" onclick="showContent('notice-view')">
                            <i class="bi bi-bell"></i> 公告查看
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#" onclick="logout()">
                            <i class="bi bi-box-arrow-right"></i> 退出登录
                        </a>
                    </li>
                </ul>
            </div>

            <!-- 右侧内容区 -->
            <div class="col-md-10 content">
                <!-- 个人信息 -->
                <div id="personal-info" class="content-section">
                    <div class="card">
                        <div class="card-header">
                            <h5 class="mb-0">个人信息</h5>
                        </div>
                        <div class="card-body">
                            <div class="row" id="employeeInfo">
                                <!-- 个人信息将在这里动态加载 -->
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 请假管理 -->
                <div id="leave-manage" class="content-section" style="display: none;">
                    <div class="card">
                        <div class="card-header d-flex justify-content-between align-items-center">
                            <h5 class="mb-0">我的请假记录</h5>
                            <button class="btn btn-primary" onclick="showApplyLeaveModal()">申请请假</button>
                        </div>
                        <div class="card-body">
                            <div class="table-responsive">
                                <table class="table">
                                    <thead>
                                        <tr>
                                            <th>请假类型</th>
                                            <th>开始时间</th>
                                            <th>结束时间</th>
                                            <th>状态</th>
                                            <th>审批人</th>
                                            <th>审批意见</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody id="leaveTableBody">
                                        <!-- 请假记录将在这里动态加载 -->
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 公告查看 -->
                <div id="notice-view" class="content-section" style="display: none;">
                    <div class="card">
                        <div class="card-header">
                            <h5 class="mb-0">公告列表</h5>
                        </div>
                        <div class="card-body">
                            <div id="noticeList">
                                <!-- 公告列表将在这里动态加载 -->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 申请请假模态框 -->
    <div class="modal fade" id="leaveModal" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">申请请假</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <div class="modal-body">
                    <form id="leaveForm">
                        <div class="mb-3">
                            <label class="form-label">请假类型</label>
                            <select class="form-select" id="leaveType" required>
                                <option value="1">事假</option>
                                <option value="2">病假</option>
                                <option value="3">年假</option>
                                <option value="4">调休</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">开始时间</label>
                            <input type="datetime-local" class="form-control" id="leaveStartTime" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">结束时间</label>
                            <input type="datetime-local" class="form-control" id="leaveEndTime" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">请假原因</label>
                            <textarea class="form-control" id="leaveReason" rows="3" required></textarea>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" onclick="submitLeave()">提交</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 错误提示模态框 -->
    <div class="modal fade" id="errorModal" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">错误提示</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <div class="modal-body">
                    <p id="errorMessage"></p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" data-bs-dismiss="modal">确定</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 成功提示模态框 -->
    <div class="modal fade" id="successModal" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">提示</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <div class="modal-body">
                    <p id="successMessage"></p>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script>
    <script src="/js/employee-center.js"></script>
</body>
</html> 